package demo04;

/**
 * @author JYH
 * @version 1.0
 * @date 2022/10/31 15:17
 */
public class Girl implements Runnable{
    private Card card;

    public Girl(Card card) {
        this.card = card;
    }

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            if (card.getBalance()>=1000){
                card.setBalance(card.getBalance()-1000);
                System.out.println(Thread.currentThread().getName()+"取出一千元,卡中余额："+card.getBalance());
            }else{
                System.out.println("余额不足");
                i--;
            }
        }
    }
}
